package org.ziegler.hotfix;

public class LineSpitWords {

    private final String line;
    private final String[] rowStrArray;

    public LineSpitWords(String line) {
        this.line = line;
        rowStrArray = line.split("\t");
    }

    public String getExcelFileName() {
        return rowStrArray.length > 0 ? rowStrArray[0] : "";
    }

    public String getSheetName() {
        return rowStrArray.length > 1 ? rowStrArray[1] : "";
    }

    public String getBeginSn() {
        return rowStrArray.length > 2 ? rowStrArray[2] : "";
    }

    public String getEndSn() {
        return rowStrArray.length > 3 ? rowStrArray[3] : "";
    }

    public String getJsonFileName() {
        final String[] sheetFullNameArray = getSheetName().split("\\|");
        if (sheetFullNameArray.length != 2) {
            return "";
        }
        return "Conf" + sheetFullNameArray[1] + ".json";
    }

    public String getFixConfigFileName() {
        final String[] sheetFullNameArray = getSheetName().split("\\|");
        if (sheetFullNameArray.length != 2) {
            return "";
        }
        return sheetFullNameArray[1] + ".fixconfig.txt";
    }

    public String getLine() {
        return line;
    }
}
